<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pywinauto.findbestmatch &mdash; pywinauto 0.5.4 documentation</title>
    
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '0.5.4',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="pywinauto 0.5.4 documentation" href="../contents.html" />
    <link rel="up" title="Main user modules" href="code.html" />
    <link rel="next" title="pywinauto.findwindows" href="pywinauto.findwindows.html" />
    <link rel="prev" title="pywinauto.application module" href="pywinauto.application.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pywinauto.findwindows.html" title="pywinauto.findwindows"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="pywinauto.application.html" title="pywinauto.application module"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">pywinauto 0.5.4 documentation</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="code.html" accesskey="U">Main user modules</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="pywinauto-findbestmatch">
<h1>pywinauto.findbestmatch<a class="headerlink" href="#pywinauto-findbestmatch" title="Permalink to this headline">¶</a></h1>
<blockquote>
<div><span class="target" id="module-pywinauto.findbestmatch"></span><p>Module to find the closest match of a string in a list</p>
<dl class="function">
<dt id="pywinauto.findbestmatch.GetNonTextControlName">
<code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">GetNonTextControlName</code><span class="sig-paren">(</span><em>ctrl</em>, <em>controls</em>, <em>text_ctrls</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.GetNonTextControlName" title="Permalink to this definition">¶</a></dt>
<dd><p>return the name for this control by finding the closest
text control above and to its left</p>
</dd></dl>

<dl class="function">
<dt id="pywinauto.findbestmatch.IsAboveOrToLeft">
<code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">IsAboveOrToLeft</code><span class="sig-paren">(</span><em>ref_control</em>, <em>other_ctrl</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.IsAboveOrToLeft" title="Permalink to this definition">¶</a></dt>
<dd><p>Return true if the other_ctrl is above or to the left of ref_control</p>
</dd></dl>

<dl class="exception">
<dt id="pywinauto.findbestmatch.MatchError">
<em class="property">exception </em><code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">MatchError</code><span class="sig-paren">(</span><em>items=None</em>, <em>tofind=u''</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.MatchError" title="Permalink to this definition">¶</a></dt>
<dd><p>A suitable match could not be found</p>
<p>Init the parent with the message</p>
</dd></dl>

<dl class="class">
<dt id="pywinauto.findbestmatch.UniqueDict">
<em class="property">class </em><code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">UniqueDict</code><a class="headerlink" href="#pywinauto.findbestmatch.UniqueDict" title="Permalink to this definition">¶</a></dt>
<dd><p>A dictionary subclass that handles making it&#8217;s keys unique</p>
<dl class="method">
<dt id="pywinauto.findbestmatch.UniqueDict.FindBestMatches">
<code class="descname">FindBestMatches</code><span class="sig-paren">(</span><em>search_text</em>, <em>clean=False</em>, <em>ignore_case=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.UniqueDict.FindBestMatches" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the best matches for search_text in the items</p>
<ul class="simple">
<li><strong>search_text</strong> the text to look for</li>
<li><strong>clean</strong> whether to clean non text characters out of the strings</li>
<li><strong>ignore_case</strong> compare strings case insensitively</li>
</ul>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="pywinauto.findbestmatch.build_unique_dict">
<code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">build_unique_dict</code><span class="sig-paren">(</span><em>controls</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.build_unique_dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Build the disambiguated list of controls</p>
<p>Separated out to a different function so that we can get
the control identifiers for printing.</p>
</dd></dl>

<dl class="function">
<dt id="pywinauto.findbestmatch.find_best_control_matches">
<code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">find_best_control_matches</code><span class="sig-paren">(</span><em>search_text</em>, <em>controls</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.find_best_control_matches" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the control that is the the best match to search_text</p>
<p>This is slightly differnt from find_best_match in that it builds
up the list of text items to search through using information
from each control. So for example for there is an OK, Button
then the following are all added to the search list:
&#8220;OK&#8221;, &#8220;Button&#8221;, &#8220;OKButton&#8221;</p>
<p>But if there is a ListView (which do not have visible &#8216;text&#8217;)
then it will just add &#8220;ListView&#8221;.</p>
</dd></dl>

<dl class="function">
<dt id="pywinauto.findbestmatch.find_best_match">
<code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">find_best_match</code><span class="sig-paren">(</span><em>search_text</em>, <em>item_texts</em>, <em>items</em>, <em>limit_ratio=0.5</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.find_best_match" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the item that best matches the search_text</p>
<ul class="simple">
<li><strong>search_text</strong> The text to search for</li>
<li><strong>item_texts</strong> The list of texts to search through</li>
<li><strong>items</strong> The list of items corresponding (1 to 1)
to the list of texts to search through.</li>
<li><strong>limit_ratio</strong> How well the text has to match the best match.
If the best match matches lower then this then it is not
considered a match and a MatchError is raised, (default = .5)</li>
</ul>
</dd></dl>

<dl class="function">
<dt id="pywinauto.findbestmatch.get_control_names">
<code class="descclassname">pywinauto.findbestmatch.</code><code class="descname">get_control_names</code><span class="sig-paren">(</span><em>control</em>, <em>allcontrols</em>, <em>textcontrols</em><span class="sig-paren">)</span><a class="headerlink" href="#pywinauto.findbestmatch.get_control_names" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of names for this control</p>
</dd></dl>

</div></blockquote>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="pywinauto.application.html"
                        title="previous chapter">pywinauto.application module</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="pywinauto.findwindows.html"
                        title="next chapter">pywinauto.findwindows</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/code/pywinauto.findbestmatch.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pywinauto.findwindows.html" title="pywinauto.findwindows"
             >next</a> |</li>
        <li class="right" >
          <a href="pywinauto.application.html" title="pywinauto.application module"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">pywinauto 0.5.4 documentation</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="code.html" >Main user modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2015, Mark Mc Mahon.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
    </div>
  </body>
</html>